from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'music_lzz.settings')

# 启动项目的名字 最好和项目名字一样 broker中间件  backend 存储结果的地方
app = Celery('music_lzz',
             broker='redis://localhost:6379',
             backend='redis://localhost:6379'

             )

# 在redis中以CELERY
app.config_from_object('django.conf:settings', namespace='CELERY')

# 使celery能够读取到所有apps里面分配的任务
app.autodiscover_tasks()